home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / RLaB 1.18c / testmatrix / cpltaxes.r < prev    next >
Encoding:
Text File  |  1994-12-20  |  1.7 KB  |  33 lines  |  [TEXT/RLAB]

  1. //-------------------------------------------------------------------//
  2.  
  3. // Synopsis:   Determine suitable AXIS for plot of complex vector.
  4.  
  5. // Syntax:     X = cpltaxes ( Z )
  6.  
  7. // Description:
  8.  
  9. //      cpltaxes determines a 4-vector X such that
  10. //      plimits(X[1],x[2],x[3].x[4]) sets axes for a plot of Z that
  11. //      has axes of equal length and leaves a reasonable amount of
  12. //      space around the edge of the plot.
  13.  
  14. //      Called by fv(), gersh(), ps() and pscont().
  15.  
  16. //    This file is a translation of cpltaxes.m from version 2.0 of
  17. //    "The Test Matrix Toolbox for Matlab", described in Numerical
  18. //    Analysis Report No. 237, December 1993, by N. J. Higham.
  19.  
  20. //-------------------------------------------------------------------//
  21.  
  22. cpltaxes = function ( z )
  23. {
  24.   // Set x and y axis ranges so both have the same length.
  25.   
  26.   xmin = min(real(z)); xmax = max(real(z));
  27.   ymin = min(imag(z)); ymax = max(imag(z));
  28.   
  29.   // Fix for rare case of `trivial data'.
  30.   if (xmin == xmax)
  31.   {
  32.     xmin = xmin - 1/2; 
  33.     xmax = xmax